package com.example.dota2draftsimulator;

import java.util.Timer;

import android.os.Bundle;
import android.os.CountDownTimer;
import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.text.Layout;
import android.view.Menu;
import android.widget.ProgressBar;

public class SplashActivity extends Activity {

	protected static final int TIMER_RUNTIME = 6000; 
	protected boolean mbActive;
	protected ProgressBar loadingBar;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_splash);
		//loadingBar = (ProgressBar)findViewById(R.id.loading_bar);
		loadingBar.setMax(5);
		
		Drawable draw = this.getResources().getDrawable(R.layout.custom_progress_bar);
		loadingBar.setProgressDrawable(draw);
		
		new CountDownTimer(TIMER_RUNTIME, 1000) {
			int tickTime = 0;
		
			@Override
			public void onTick(long millisUntilFinished) {
				// TODO Auto-generated method stub
				tickTime++;
				loadingBar.setProgress(tickTime);
			}

			@Override
			public void onFinish() {
				// TODO Auto-generated method stub
				Intent homeIntent = new Intent(SplashActivity.this, MainActivity.class);
				startActivity(homeIntent);
				finish();
			}
		}.start();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.splash, menu);
		return true;		
	}

}
